// 分数和等级
class ScorePanel {
    score = 0;
    level = 1;
    scorlEle: HTMLElement;
    levelEle: HTMLElement;
    maxLevel: number;//满级多少
    upScore: number;//多少分升级一次
    constructor(maxLevel: number = 10, upScore: number = 10) {
        this.scorlEle = document.getElementById('score')!;
        this.levelEle = document.getElementById('level')!;
        this.maxLevel = maxLevel;
        this.upScore = upScore;
    }
    // 每多少分提升一级
    addScore() {
        this.scorlEle.innerHTML = ++this.score + '';
        if (this.score % this.upScore === 0) {
            this.addLevel();
        }
    }
    // 提升等级
    addLevel() {
        if (this.level < this.maxLevel) this.levelEle.innerHTML = ++this.level + '';
    }
}
export default ScorePanel;